export const validateMobile = (rule, value, callback) => {
  if (!value) return callback(new Error("请输入手机号"));
  const reg = /^1[3|4|5|7|8][0-9]\d{8}$/;
  if (reg.test(value)) {
    callback();
  } else {
    return callback(new Error("请输入正确的手机号"));
  }
};
export const validateName = (rule, value, callback) => {
  if (!value) return callback(new Error("请输入姓名"));
  const reg = /^\S{1,100}$/;
  if (reg.test(value)) {
    callback();
  } else {
    return callback(new Error("请输入正确的姓名"));
  }
};

export const validatePassword = (rule, value, callback) => {
  if (!value) return callback(new Error("请输入密码"));
  const reg = /^\S{6,15}$/;
  if (reg.test(value)) {
    callback();
  } else {
    return callback(new Error("密码必须是6 ~ 15位的非空字符"));
  }
};
export const validateEmail = (rule, value, callback) => {
  if (!value) return callback(new Error("请输入邮箱"));
  const reg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*$/;
  if (reg.test(value)) {
    callback();
  } else {
    return callback(new Error("请输入正确的邮箱"));
  }
};
